<?php
/**
 * Description of class
 *
 * @author ������
 */
class LoginFabric {
  
    private static $names = array('std' => 'stdLoginStrategy', 'VK' => 'VKLoginStrategy',
        'Steam' => 'SteamLoginStrategy');

    
    
    public static function getLoginStrategy($name) {
        if(empty($name)) throw new Exception('�� ������ ��������� ������.');
        
        Registry::getInstance()->load->library('class.LoginStrategy.php', 'user');
        Registry::getInstance()->load->library('class.'.$name.'LoginStrategy.php', 'user');
        
        if (class_exists(self::$names[$name])) {
            
            $ret_class = new self::$names[$name]();
            //��������� ����������
            return $ret_class;
        } else {
            throw new Exception('class of strategy not found.');
        }
    }
}
?>
